package filter

import(
	"github.com/astaxie/beego/context"
	"github.com/astaxie/beego"
	"fmt"
)

func Auth(ctx *context.Context){
	 v,ok := ctx.Input.Session("isLogin").(bool)
	fmt.Println("\r\n:当前登陆情况：",v,"\r\n")
    if (!v || !ok) && ctx.Request.RequestURI != "/user/login"{
        ctx.Redirect(302, "/user/login")
    }
}
func init(){
	beego.InsertFilter("/*",beego.BeforeRouter,Auth)
}